﻿@model Ninesky.Models.Category
@{
    ViewData["Title"] = "添加栏目";
}

<ol class="breadcrumb">
    <li><span class="glyphicon glyphicon-home"></span>  <a asp-controller="Home" asp-action="Index">首页</a></li>
    <li><a asp-controller="Category" asp-action="Index">栏目管理</a></li>
    <li class="active">添加常规栏目</li>
</ol>

<div class="panel panel-default">
    <div class="panel-body">
        <form asp-action="Add">
            <div class="form-horizontal">
                <div asp-validation-summary="ModelOnly" class="text-danger"></div>
                <input type="hidden" asp-for="Type" />
                <div class="form-group">
                    <label asp-for="ParentId" class="col-md-2 control-label"></label>
                    <div class="col-md-10">
                        <div class="dropdown">
                            <button class="btn btn-dropdown dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-expanded="true">
                                无
                                <span class="caret"></span>
                            </button>
                            <div class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu1">
                                <ul id="dropdown-categorytree" class="ztree"></ul>
                            </div>
                            <input asp-for="ParentId" class="form-control" style="width:0; visibility:hidden; position:absolute;padding:0" />
                        </div>


                        <span asp-validation-for="ParentId" class="text-danger"></span>
                    </div>
                </div>
                <div class="form-group">
                    <label asp-for="Name" class="col-md-2 control-label"></label>
                    <div class="col-md-10">
                        <input asp-for="Name" class="form-control" />
                        <span asp-validation-for="Name" class="text-danger"></span>
                    </div>
                </div>
                <div class="form-group">
                    <label asp-for="Order" class="col-md-2 control-label"></label>
                    <div class="col-md-10">
                        <input asp-for="Order" class="form-control" />
                        <span asp-validation-for="Order" class="text-danger"></span>
                    </div>
                </div>
                <div class="form-group">
                    <label asp-for="Target" class="col-md-2 control-label"></label>
                    <div class="col-md-10">
                        <select asp-for="Target" asp-items="Html.GetEnumSelectList<Ninesky.Models.LinkTarget>()" class="selectpicker" data-style="btn-dropdown"></select>
                        <span asp-validation-for="Target" class="text-danger"></span>
                    </div>
                </div>
                <div class="form-group">
                    <label asp-for="Description" class="col-md-2 control-label"></label>
                    <div class="col-md-10">
                        <input asp-for="Description" class="form-control" />
                        <span asp-validation-for="Description" class="text-danger"></span>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-offset-2 col-md-10">
                        <input type="submit" value="添加" class="btn btn-default" />
                    </div>
                </div>
            </div>
        </form>
    </div>
</div>
@section aside{

    @Html.Partial("Aside")
}
@section Scripts {
    @{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
    <script type="text/javascript">
        var zTreeObj;
        // zTree 的参数配置，深入使用请参考 API 文档（setting 配置详解）
        $(document).ready(function () {
            InitTree("#dropdown-categorytree", null, "@Url.Action("ParentTree", "Category")", {})
            InitTree("#categoryTree", null, "@Url.Action("Tree", "Category")", {})

        });
        //$('.dropdown').on('hide.bs.dropdown', function () {
        //    return false;
        //});
    </script>
}
